﻿using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using Happy.Command;
using Happy.Examples.OrderManagement.Commands.Orders;

namespace Happy.Examples.OrderManagement.IntegrationTest.Orders
{
    [TestClass]
    public class OrderTest
    {
        [TestMethod]
        public void Order_CreateOrderCommand_Test()
        {
            var command = new CreateOrderCommand
            {
                Order = new OrderInfo
                {
                    Id = Guid.NewGuid(),
                    CustomerName = "段光伟",
                    CustomerAddress = "广州",
                    CustomerTel = "13666666666",
                    OrderItems = new List<OrderItemInfo>
                    {
                        new OrderItemInfo{ ProductId = Guid.NewGuid(), Product = "苹果", Price = 10, Quantity = 5 },
                        new OrderItemInfo{ ProductId = Guid.NewGuid(), Product = "香蕉", Price = 5, Quantity = 4 }
                    }
                }
            };

            CommandService.Current.Execute(command);
        }
    }
}
